package com.luo.chengrui.module.sa.dal.mysql.role;

import java.util.*;

import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX;
import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX;
import com.luo.chengrui.module.sa.dal.dataobject.role.RoleFolderModuleDO;
import org.apache.ibatis.annotations.Mapper;
import com.luo.chengrui.module.sa.controller.admin.role.vo.*;

/**
 * 角色分类模块配置表 Mapper
 *
 * @author 诚睿
 */
@Mapper
public interface RoleFolderModuleMapper extends BaseMapperX<RoleFolderModuleDO> {

    default PageResult<RoleFolderModuleDO> selectPage(RoleFolderModulePageReqVO reqVO) {
        return selectPage(reqVO, new LambdaQueryWrapperX<RoleFolderModuleDO>()
                .eqIfPresent(RoleFolderModuleDO::getRoleFolderId, reqVO.getRoleFolderId())
                .eqIfPresent(RoleFolderModuleDO::getModuleid, reqVO.getModuleid())
                .orderByDesc(RoleFolderModuleDO::getId));
    }

    default List<RoleFolderModuleDO> selectList(RoleFolderModuleExportReqVO reqVO) {
        return selectList(new LambdaQueryWrapperX<RoleFolderModuleDO>()
                .eqIfPresent(RoleFolderModuleDO::getRoleFolderId, reqVO.getRoleFolderId())
                .eqIfPresent(RoleFolderModuleDO::getModuleid, reqVO.getModuleid())
                .orderByDesc(RoleFolderModuleDO::getId));
    }

    default RoleFolderModuleDO selectByRoleFolderId(String roleFolderId) {
        return selectOne(new LambdaQueryWrapperX<RoleFolderModuleDO>()
                .eqIfPresent(RoleFolderModuleDO::getRoleFolderId, roleFolderId)
        );
    }
}
